﻿<common:LayoutAwarePage
	x:Name="pageRoot"
	x:Class="MyVideoManager2.SplitPage"
	DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:local="using:MyVideoManager2"
	xmlns:data="using:MyVideoManager2.Data"
	xmlns:common="using:MyVideoManager2.Common"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d">
	
	<Page.Resources>

		<!-- Collection d'éléments affichés par cette page -->
		<CollectionViewSource
			x:Name="itemsViewSource"
			Source="{Binding Items}"
			d:Source="{Binding AllGroups[0].Items, Source={d:DesignInstance Type=data:Data, IsDesignTimeCreatable=True}}"/>
	</Page.Resources>
	<Page.BottomAppBar>
	  <AppBar x:Name="btmAppbar">
		<StackPanel Orientation="Horizontal" FlowDirection="RightToLeft">
			<Button x:Name="EditMovieAppBarButton" Click="EditMovie" IsEnabled="true" Style="{StaticResource EditAppBarButtonStyle}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0" Canvas.ZIndex="-1"/>
			<Button x:Name="AddMoviesAppBarButton" Click="FileSelecter" IsEnabled="true" Style="{StaticResource AddAppBarButtonStyle}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0" Canvas.ZIndex="-1"/>
			<Button x:Name="RefreshFolderAppBarButton" Click="RefreshFolder" IsEnabled="true" Style="{StaticResource RefreshAppBarButtonStyle}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0" Canvas.ZIndex="-1"/>
		</StackPanel>
	  </AppBar>
  </Page.BottomAppBar>

	<!--
		La grille sert de panneau racine à la page, permettant de définir deux lignes :
		* La ligne 0 qui contient le bouton Précédent et le titre de la page
		* La ligne 1 qui contient le reste de la page
	-->
	<Grid x:Name="Page" Style="{StaticResource LayoutRootStyle}"
		DataContext="{Binding Group}"
		d:DataContext="{Binding AllGroups[0], Source={d:DesignInstance Type=data:Data, IsDesignTimeCreatable=True}}">
		<VisualStateManager.VisualStateGroups>
			<VisualStateGroup x:Name="VisualStateGroup">
				<VisualStateGroup.Transitions>
					<VisualTransition GeneratedDuration="0:0:2"/>
				</VisualStateGroup.Transitions>
				<VisualState x:Name="FullScreenLandscape"/>
				<VisualState x:Name="Filled" />
				<VisualState x:Name="FullScreenPortrait" />
				<VisualState x:Name="Snapped">
					<Storyboard>
						<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SnappedView" Storyboard.TargetProperty="Visibility">
							<DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
						</ObjectAnimationUsingKeyFrames>
						<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DefaultView" Storyboard.TargetProperty="Visibility">
							<DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
						</ObjectAnimationUsingKeyFrames>
					</Storyboard>
				</VisualState>
			</VisualStateGroup>
		</VisualStateManager.VisualStateGroups>
		<Grid x:Name="DefaultView">
			

		<!-- Détails de l'élément sélectionné -->
			<Grid x:Name="Top" Height="130" VerticalAlignment="Top" Grid.ColumnSpan="2">
				<Button x:Name="backButton" Click="GoBack" IsEnabled="true" Style="{StaticResource BackButtonStyle}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="42,42,0,0" Canvas.ZIndex="-1"/>
				<TextBlock x:Name="pageTitle" Text="My Video Manager" IsHitTestVisible="false" Style="{StaticResource PageHeaderTextStyle}" VerticalAlignment="Top" HorizontalAlignment="Left" Height="40" Width="479" Margin="139,42,0,0"/>
			</Grid>
			<Grid x:Name="Mid" Margin="0,130,0,0" Grid.ColumnSpan="2">
			<Grid.ColumnDefinitions>
				<ColumnDefinition/>
				<ColumnDefinition/>
			</Grid.ColumnDefinitions>
				<Grid x:Name="Left" Margin="0" MinWidth="500">
					<ListView
						x:Name="itemListView"
						AutomationProperties.AutomationId="ItemsListView"
						AutomationProperties.Name="Items"
						TabIndex="1"
						Padding="50,0"
						ItemsSource="{Binding Source={StaticResource itemsViewSource}}"
						IsSwipeEnabled="False"
						SelectionChanged="ItemListView_SelectionChanged"
						ItemTemplate="{StaticResource Standard130ItemTemplate}" Margin="0"/>
				</Grid>
				<Grid x:Name="Right" Grid.Column="1">
					<ScrollViewer
						x:Name="itemDetail"
						AutomationProperties.AutomationId="ItemDetailScrollViewer"
						Padding="50,0"
						DataContext="{Binding SelectedItem, ElementName=itemListView}"
						d:DataContext="{Binding AllGroups[0].Items[0], Source={d:DesignInstance IsDesignTimeCreatable=True, Type=data:Data}}"
						Style="{StaticResource VerticalScrollViewerStyle}" Margin="0,-130,0,0"
                        
                        >

						<Grid x:Name="itemDetailGrid" Margin="0,50,0,0">
							<Grid.RowDefinitions>
								<RowDefinition Height="Auto"/>
								<RowDefinition Height="Auto"/>
								<RowDefinition Height="*"/>
							</Grid.RowDefinitions>
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="Auto"/>
								<ColumnDefinition Width="*"/>
							</Grid.ColumnDefinitions>

							<Image Grid.Row="1" Margin="0,0,20,0" Width="180" Height="240" Source="{Binding Image}" Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/>
							<StackPanel x:Name="itemDetailTitlePanel" Grid.Row="1" Grid.Column="1">
								<TextBox x:Name="itemTitle" Margin="0,-10,0,0" Text="{Binding TitreFilm}"  IsEnabled="{Binding IsEdit, Mode=TwoWay}" Background="{x:Null}" LostFocus="lostFocus"/>
                                <TextBox x:Name="itemOriginalTitle" Margin="0,0,0,20" Text="{Binding TitreFilmOriginal}"    IsEnabled="{Binding IsEdit, Mode=TwoWay}"  LostFocus="lostFocus"/>
                                <TextBox x:Name="itemActors" Margin="0,0,0,20" Text="{Binding LstActeur}"  IsEnabled="{Binding IsEdit, Mode=TwoWay}" LostFocus="lostFocus"/>
                                <TextBox x:Name="itemAnnee" Margin="0,0,0,20" Text="{Binding AnneeSortie}"    IsEnabled="{Binding IsEdit, Mode=TwoWay}" LostFocus="lostFocus"/>
							</StackPanel>
							<TextBlock x:Name="itemDescription" Grid.Row="2" Grid.ColumnSpan="2" Margin="0,20,0,0" Text="{Binding DescriptionFilm}" Style="{StaticResource BodyTextStyle}"/>
						</Grid>
					</ScrollViewer>
				</Grid>
			</Grid>
		</Grid>
		<Grid x:Name="SnappedView" Visibility="Collapsed">
				<Grid x:Name="itemDetailGridSnapped">
					<StackPanel x:Name="itemDetailTitlePanelSnapped" Margin="30,30,10,0">
						<Image Width="180" Height="240" Source="{Binding Image}" Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,0,0,30"/>
						<TextBlock x:Name="itemTitleSnapped" Margin="0,-10,0,0" Text="{Binding Title}" Style="{StaticResource SubheaderTextStyle}"/>
						<TextBlock x:Name="itemOriginalTitleSnapped" Margin="0,0,0,20" Text="{Binding OriginalTitle}" Style="{StaticResource SubtitleTextStyle}"/>
						<TextBlock x:Name="itemActorsSnapped" Margin="0,0,0,20" Text="{Binding Actors}" Style="{StaticResource SubtitleTextStyle}"/>
						<TextBlock x:Name="itemDateSnapped" Margin="0,0,0,20" Text="{Binding Date}" Style="{StaticResource SubtitleTextStyle}"/>
						<TextBlock Grid.Row="2" Grid.ColumnSpan="2" Margin="0,20,0,0" Text="{Binding Content}" Style="{StaticResource BodyTextStyle}"/>
					</StackPanel>
					<Button x:Name="backButton_Copy" Click="GoBack" IsEnabled="true" Style="{StaticResource BackButtonStyle}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="14,42,0,0" Canvas.ZIndex="-1"/>
				</Grid>
		</Grid>
	</Grid>


</common:LayoutAwarePage>
